home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / PBLIB1 / UNITS / PBOUT0.PAS < prev    next >
Pascal/Delphi Source File  |  1994-05-03  |  7KB  |  316 lines

  1. {SECTION ..PbOUT0 }
  2. UNIT PbOUT0;
  3.  
  4. INTERFACE
  5.  
  6. uses PbMISC, PbDATA, PbOBJS, PbPARMS;
  7.  
  8.  
  9. {
  10. Description : Medium level Use of OUT_object
  11.  
  12. Author      : Howard Richoux
  13. Date        : 12/24/93
  14. Last revised:  2/18/94 changed libraries
  15. Application : IBM PC and compatibles, done in Turbo Pascal 7
  16. Status      : Placed in the Public Domain by HNR Software 1/29/1994
  17. Published in: none
  18.  
  19.      OUT is a shell around the OUT_object so that calling
  20. programs don't have to worry about a lot of the details.  They
  21. also don't get much control, just the pre-open variables set
  22. in the program and through PARMS.
  23.  
  24. Through the variables are options for CON/LPT1/file output,
  25.      compressed & landscape printing, headers and footers.
  26.  
  27. Use is:
  28.           StandardOUTInit;
  29.           ...
  30.           OUT(<string>);
  31.           ...
  32.           OUTdone;
  33.  
  34. Use PbOUT0 for simple output, PbOUT1 for Headers/footers/ ...
  35. }
  36.  
  37. var pCompressed : boolean;
  38. var pLandscape  : boolean;
  39.  
  40.  
  41. Procedure OUT(s:string);
  42.              {[OUT] Outputs a string }
  43.  
  44. Procedure OUTChangeAPPEND(fn : string);
  45.              {[OUT] Closes current output file/dev opens a new one APPEND }
  46.  
  47. Procedure OUTChangeREWRITE(fn : string);
  48.              {[OUT] Closes current output file/dev opens a new one CLEARING contents }
  49.  
  50. Function  OUTcompressed : boolean;
  51.              {[OUT] Returns true if output compressed }
  52.  
  53. Function  OUTCurrentLineLen : integer;
  54.              {[OUT] Returns current line length }
  55.  
  56. Function  OUTcurrentPage : integer;
  57.              {[OUT] Returns current page number }
  58.  
  59. Procedure OUTdone;
  60.              {[OUT] Closes output device }
  61.  
  62. Procedure OUTdoneWithPage;
  63.              {[OUT] Next line will go on new page }
  64.  
  65. Function  OUTLinesLeft : integer;
  66.              {[OUT] lines left on current page }
  67.  
  68. Procedure OUTNoCR(s:string);
  69.              {[OUT] Outputs a string - NO CR/LF }
  70.  
  71. Procedure OUTSetCompressed;
  72.              {[OUT] Go to Compressed print }
  73.  
  74. Procedure OUTSetHeaders(h1,h2,h3,f1,f2 : string);
  75.              {[OUT] Dummy to make it easier to switch to PbOUT0 }
  76.  
  77. Procedure OUTSetIndent( i : integer);
  78.              {[OUT] Extra left space }
  79.  
  80. Procedure OUTSetLandscape;
  81.              {[OUT] Go to Landscape Mode }
  82.  
  83. Procedure OUTSetLengths(ll,pl : integer);
  84.              {[OUT] Manual override }
  85.  
  86. Procedure OUTSetNoPause;
  87.              {[OUT] Cancels pausing on CRT output }
  88.  
  89. Procedure OUTSetNoPrint;
  90.              {[OUT] Suppress output, keep bookkeeping }
  91.  
  92. Procedure OUTSetPrint;
  93.              {[OUT] Turn printing back on. }
  94.  
  95. Procedure OUTPause;
  96.              {[OUT] Pauses if CRT output. }
  97.  
  98. Procedure StandardOUTInit;
  99.              {[OUT] Support for PbOUT; calls StandardpVarsInit }
  100.  
  101.  
  102. { extra utility procs using PbOUT0 basic calls }
  103.  
  104. Procedure OUTDOSErr(s : string; e : integer);
  105.              {[OUT] Outputs a line containing the DOS error message}
  106.  
  107.  
  108. {SECTION .ZIMPLEMENTATION }
  109. IMPLEMENTATION
  110.  
  111. var Outp        : OUT_object_0;
  112.  
  113. {SECTION  AddOUTpVars }
  114. Procedure AddOUTpVars;
  115.      begin
  116.      AddParm(1,'COMPRESSED','NO');
  117.      AddParm(1,'LANDSCAPE','NO');
  118.      end;
  119.  
  120.  
  121. {SECTION  GetOUTpVars }
  122. Procedure GetOUTpVars;
  123.      begin
  124.      pCompressed := CheckOK('COMPRESSED');
  125.      pLandscape  := CheckOK('LANDSCAPE');
  126.      end;
  127.  
  128.  
  129. {SECTION  OUT }
  130. Procedure OUT(s:string);
  131.      begin
  132.      Outp.out(s);
  133.      end;
  134.  
  135.  
  136. {SECTION  OUTChangeAPPEND }
  137. Procedure OUTChangeAPPEND(fn : string);
  138.              {[OUT] Closes current output file/dev opens a new one APPEND }
  139.      begin
  140.      Outp.done;
  141.      pOutFile := fn;
  142.      OUTp.LISTinit(pOutFile,OUT_typAPPEND);
  143.      if pCompressed then OUTp.SetCompressed;
  144.      if pLandscape  then OUTp.SetLandscape;
  145.      OUTp.LISTopen;
  146.      end;
  147.  
  148.  
  149. {SECTION  OUTChangeREWRITE }
  150. Procedure OUTChangeREWRITE(fn : string);
  151.              {[OUT] Closes current output file/dev opens a new one CLEARING contents }
  152.      begin
  153.      Outp.done;
  154.      pOutFile := fn;
  155.      OUTp.LISTinit(pOutFile,OUT_typREWRITE);
  156.      if pCompressed then OUTp.SetCompressed;
  157.      if pLandscape  then OUTp.SetLandscape;
  158.      OUTp.LISTopen;
  159.      end;
  160.  
  161.  
  162.  
  163. {SECTION  OUTCompressed }
  164. Function  OUTcompressed : boolean;
  165.      begin
  166.      OUTCompressed := Outp.compressed;
  167.      end;
  168.  
  169.  
  170. {SECTION  OUTCurrentLineLen }
  171. Function  OUTCurrentLineLen : integer;
  172.      begin
  173.      OUTCurrentLineLen := Outp.currllen;
  174.      end;
  175.  
  176.  
  177. {SECTION  OUTCurrentPage }
  178. Function  OUTCurrentPage : integer;
  179.      begin
  180.      OUTCurrentPage := Outp.currpage;
  181.      end;
  182.  
  183.  
  184. {SECTION  OUTdone }
  185. Procedure OUTdone;
  186.      begin
  187.      Outp.done;
  188.      end;
  189.  
  190.  
  191. {SECTION  OUTdoneWithPage }
  192. Procedure OUTdoneWithPage;
  193.      begin
  194.      Outp.DoneWithPage;
  195.      end;
  196.  
  197.  
  198. {SECTION  OUTLinesLeft }
  199. Function  OUTLinesLeft : integer;
  200.              {[OUT] lines left on current page }
  201.      begin
  202.      OUTLinesLeft := (Outp.plen - Outp.currline) + 1;
  203.      end;
  204.  
  205.  
  206. {SECTION  OUTNoCR }
  207. Procedure OUTNoCR(s:string);
  208.      begin
  209.      Outp.outERRNoCR(s);  { no CR/LF and no bookkeeping }
  210.      end;
  211.  
  212.  
  213.  
  214. {SECTION  OUTPause }
  215. Procedure OUTPause;
  216.      begin
  217.      Outp.pause;
  218.      end;
  219.  
  220.  
  221. {SECTION  OUTSetCompressed }
  222. Procedure OUTSetCompressed;
  223.      begin
  224.      Outp.SetCompressed;
  225.      end;
  226.  
  227.  
  228. {SECTION  OUTSetHeaders }
  229. Procedure OUTSetHeaders(h1,h2,h3,f1,f2 : string);
  230.      begin
  231.      { dummy call }
  232.      end;
  233.  
  234.  
  235. {SECTION  OUTSetIndent }
  236. Procedure OUTSetIndent( i : integer);
  237.      begin
  238.      Outp.SetIndent(i);
  239.      end;
  240.  
  241.  
  242. {SECTION  OUTSetLandscape }
  243. Procedure OUTSetLandscape;
  244.      begin
  245.      Outp.SetLandscape;
  246.      end;
  247.  
  248.  
  249. {SECTION  OUTSetLengths }
  250. Procedure OUTSetLengths(ll,pl : integer);
  251.      begin
  252.      Outp.llen := ll;
  253.      Outp.plen := pl;
  254.      end;
  255.  
  256.  
  257. {SECTION  OUTSetNoPause }
  258. Procedure OUTSetNoPause;
  259.      begin
  260.      Outp.SetNoPause;
  261.      end;
  262.  
  263.  
  264. {SECTION  OUTSetNoPrint }
  265. Procedure OUTSetNoPrint;
  266.      begin
  267.      Outp.noprint := true;
  268.      end;
  269.  
  270.  
  271. {SECTION  OUTSetPrint }
  272. Procedure OUTSetPrint;
  273.      begin
  274.      Outp.noprint := false;
  275.      end;
  276.  
  277.  
  278. {SECTION  StandardOUTInit }
  279. Procedure StandardOUTInit;
  280.      begin
  281.  
  282.      StandardpVarsInit;    { Picks up the other pVars as well }
  283.      GetOUTpVars;          { OUT specific pVars }
  284.  
  285.      if ScanParms('P') then pOutFile := 'LPT1';
  286.  
  287.      OUTp.LISTinit(pOutFile,OUT_typAPPEND);
  288.      if pCompressed then OUTp.SetCompressed;
  289.      if pLandscape  then OUTp.SetLandscape;
  290.      OUTp.LISTopen;
  291.      end;
  292.  
  293.  
  294. {SECTION  OUTDOSErr }
  295. Procedure OUTDOSErr(s : string; e : integer);
  296. {[OUT] Outputs a line containing the DOS error message}
  297.      begin
  298.      OUT(s+' '+DOSErrStr(e));
  299.      end;
  300.  
  301.  
  302. {SECTION  zPbOUTInit }
  303. Procedure zPbOUTInit;
  304.      begin
  305.      pCompressed := false;
  306.      pLandscape  := false;
  307.      AddOUTpVars;          { OUT specific pVars }
  308.      end;
  309.  
  310.  
  311.  
  312. {SECTION  zzInitialization }
  313.      begin {initialization}
  314.      zPbOUTInit;
  315.      end.
  316.